package com.fingard.dsp.bank.reqrespobj.authforrec;

import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RetAtsBase;
import com.fingard.xml.XmlTextWriter;


public class RetAtsAuthForRec extends RetAtsBase {

    public RetAtsAuthForRec(ReqRespHeader p_header) {
        retHeader = p_header;
        retXmlWriter = new XmlTextWriter();//用于输出返回ATS的XML报文
    }

	/*
<ATSYH>
  <TransResp>
    <BankCode>ICBC02</BankCode>
    <TransType>ENDIIMPT</TransType>
    <TransSeqID>200906091453349</TransSeqID>
    <DspState>
        <RespCode>Dsp内部处理状态</RespCode>
        <!--注：当RespCode=-1的时候，无须再关注 RetCode 状态，业务系统需要直接认为是 授权失败！-->
        <RespInfo>Dsp内部处理异常信息</RespInfo>
    </DspState>
    <ReqSeqID>指令包序列号</ReqSeqID>
    <RetCode>交易返回码</RetCode>
    <RetMsg>交易返回描述</RetMsg>
    <SerialNo>平台交易流水号</SerialNo>
  </TransResp>
</ATSYH>
	 * */

    public String respCode;
    public String respInfo;

    public String reqSeqID;

    /**0：成功， 1：失败， 2：异常*/
    public String retCode;
    public String retMsg;

    public String serialNo;

    public void writeRetToATS() {
        retXmlWriter.writeStartDocument();
        retXmlWriter.writeStartElement("ATSYH");
        retXmlWriter.writeStartElement("TransResp");

        retXmlWriter.writeElementString("BankCode", retHeader.bankCode);
        retXmlWriter.writeElementString("TransType", retHeader.transType);
        retXmlWriter.writeElementString("TransSeqID", retHeader.transSeqID);

        retXmlWriter.writeStartElement("DspState");
        retXmlWriter.writeElementString("RespCode", respCode);
        retXmlWriter.writeElementString("RespInfo", respInfo);
        retXmlWriter.writeEndElement();
        retXmlWriter.writeElementString("ReqSeqID", reqSeqID);

        retXmlWriter.writeElementString("RetCode", retCode);
        retXmlWriter.writeElementString("RetMsg", retMsg);
        retXmlWriter.writeElementString("SerialNo", serialNo);

        writeEnd();//写结束
    }

}
